﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;

namespace ContadorDeHoras.DAL
{
    public class Connection
    {
        private static String conexaoString = ConfigurationManager.ConnectionStrings["bancoHoras"].ConnectionString;
        private SqlConnection conexao;
        private static Connection instancia;

        private Connection() {
            conexao = new SqlConnection(conexaoString);
        }

        public static Connection getConnection()
        {
            if (instancia == null)
            {
                instancia = new Connection();
            }
            return instancia;
        }

        public SqlConnection getConexao() {
            this.conexao.Open();
            return this.conexao;
        }

        public void closeConexao() {
            this.conexao.Close();
        }

    }
}
